<template>
  <div class="bullet-predict-card-large">
    <n-card :bordered="true" class="predict-card" size="small">
      <!-- 卡片头部 -->
      <template #header>
        <div class="card-header">
          <div class="bullet-info">
            <div class="bullet-image-container">
              <img
                :src="item.image_url"
                :alt="item.name"
                class="bullet-image"
                :class="getGradeClass(item.grade)"
              />
              <div class="grade-badge" :class="getGradeClass(item.grade)">
                {{ item.grade }}
              </div>
            </div>

            <div class="bullet-details">
              <n-text class="bullet-name" :title="item.name">{{ item.name }}</n-text>
              <n-text :depth="3" class="bullet-type">{{ item.bullet_type }}</n-text>
            </div>
          </div>

          <div class="confidence-badge">
            <n-tag
              :type="getConfidenceType(item.confidence)"
              size="small"
            >
              {{ getConfidenceText(item.confidence) }}
            </n-tag>
          </div>
        </div>
      </template>

      <div class="card-content">
        <!-- 价格信息区域 -->
        <div class="price-section">
          <div class="price-row">
            <div class="price-item">
              <n-text :depth="3" class="price-label">当前价格</n-text>
              <n-text class="price-value current">{{ formatPrice(item.current_price) }}</n-text>
            </div>

            <div class="price-item">
              <n-text :depth="3" class="price-label">预测价格</n-text>
              <n-text class="price-value predict">{{ formatPrice(item.predict_price) }}</n-text>
            </div>

            <div class="price-item">
              <n-text :depth="3" class="price-label">预期变化</n-text>
              <n-text
                class="price-value change"
                :style="{ color: getChangeColor(item.current_price, item.predict_price) }"
              >
                {{ getChangePercent(item.current_price, item.predict_price) }}
              </n-text>
            </div>
          </div>
        </div>

        <!-- 历史价格趋势 -->
        <div class="price-history-section">
          <div class="section-title">
            <n-text strong class="title-text">历史价格趋势</n-text>
          </div>

          <!-- 历史价格图表 -->
          <PriceHistoryMiniChart
            :price-history="item.price_history"
          />
        </div>

        <!-- 未来价格预测 -->
        <div class="future-predictions-section">
          <div class="section-title">
            <n-text strong class="title-text">未来价格预测</n-text>
          </div>

          <!-- 价格趋势图表 -->
          <FuturePriceMiniChart
            :current-price="Number(item.current_price)"
            :future-predictions="item.analysis.future_predictions"
          />

          <div class="predictions-grid">
            <div
              v-for="(prediction, days) in item.analysis.future_predictions"
              :key="days"
              class="prediction-item"
            >
              <n-text :depth="3" class="prediction-date">{{ prediction.date }}</n-text>
              <n-text class="prediction-price">{{ formatPrice(prediction.price) }}</n-text>
              <n-text
                class="prediction-change"
                :style="{ color: getChangeColor(item.current_price, prediction.price) }"
              >
                {{ prediction.change_percent > 0 ? '+' : '' }}{{ prediction.change_percent.toFixed(1) }}%
              </n-text>
            </div>
          </div>
        </div>

        <!-- 价格目标时间 -->
        <div class="target-prices-section" v-if="item.analysis.target_prices.length > 0">
          <div class="section-title">
            <n-text strong class="title-text">价格目标时间</n-text>
          </div>
          <div class="targets-list">
            <div
              v-for="target in item.analysis.target_prices"
              :key="target.price"
              class="target-item"
            >
              <div class="target-price">
                <n-text class="target-value">{{ formatPrice(target.price) }}</n-text>
                <n-text :depth="3" class="target-date">{{ target.date }}</n-text>
              </div>
              <div class="target-info">
                <n-text :depth="3" class="target-days">{{ target.days }}天后</n-text>
                <n-text
                  class="target-change"
                  :style="{ color: getChangeColor(item.current_price, target.price) }"
                >
                  {{ target.change_percent > 0 ? '+' : '' }}{{ target.change_percent.toFixed(1) }}%
                </n-text>
              </div>
            </div>
          </div>
        </div>

        <!-- 基础分析指标 -->
        <div class="basic-analysis-section">
          <div class="basic-metrics">
            <div class="metric-tag">
              <n-text :depth="3" class="metric-label">波动性</n-text>
              <n-text class="metric-value">{{ getVolatilityText(item.price_volatility) }}</n-text>
            </div>

            <div class="metric-tag">
              <n-text :depth="3" class="metric-label">趋势强度</n-text>
              <n-text class="metric-value">{{ getTrendStrengthText(item.trend_strength) }}</n-text>
            </div>

            <div class="metric-tag">
              <n-text :depth="3" class="metric-label">可信度</n-text>
              <n-text class="metric-value">{{ getConfidenceText(item.confidence) }}</n-text>
            </div>
          </div>
        </div>



        <!-- 市场分析指标 - 可展开 -->
        <div class="market-analysis-toggle">
          <div class="toggle-header" @click="toggleMarketAnalysis">
            <n-text strong class="toggle-title">市场分析指标</n-text>
            <n-icon :size="16" class="toggle-icon" :class="{ 'expanded': showMarketAnalysis }">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
                <path fill="currentColor" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/>
              </svg>
            </n-icon>
          </div>

          <n-collapse-transition :show="showMarketAnalysis">
            <div class="market-analysis-content">
            <!-- 价格区间 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">价格区间</n-text>
              </div>
              <div class="price-range">
                <n-text class="range-text">{{ formatPrice(item.analysis.min_price) }} - {{ formatPrice(item.analysis.max_price) }}</n-text>
                <div class="range-bar">
                  <div class="range-progress" :style="{ width: '60%' }"></div>
                </div>
              </div>
            </div>

            <!-- 支撑位/压力位 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">支撑位/压力位</n-text>
              </div>
              <div class="support-resistance">
                <div class="sr-item">
                  <n-text :depth="3" class="sr-label">支撑位</n-text>
                  <n-text class="sr-value support">{{ formatPrice(item.analysis.support_level) }}</n-text>
                </div>
                <div class="sr-item">
                  <n-text :depth="3" class="sr-label">压力位</n-text>
                  <n-text class="sr-value resistance">{{ formatPrice(item.analysis.resistance_level) }}</n-text>
                </div>
              </div>
            </div>

            <!-- 周周期均价 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">周周期均价</n-text>
              </div>
              <div class="weekly-data">
                <div class="weekly-table">
                  <div class="weekly-header">
                    <n-text :depth="3" class="week-header">星期</n-text>
                    <n-text :depth="3" class="week-header">均价</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期一</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.mon) }}</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期二</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.tue) }}</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期三</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.wed) }}</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期四</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.thu) }}</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期五</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.fri) }}</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期六</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.sat) }}</n-text>
                  </div>
                  <div class="weekly-row">
                    <n-text :depth="3" class="week-day">星期日</n-text>
                    <n-text class="week-price">{{ formatPrice(item.weekly_pattern.sun) }}</n-text>
                  </div>
                </div>
              </div>
            </div>

            <!-- 相关品类趋势 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">相关品类趋势</n-text>
              </div>
              <div class="related-trends">
                <div class="trend-row">
                  <n-text :depth="3" class="trend-category">枪械均价</n-text>
                  <n-text class="trend-price">{{ formatPrice(item.related_items_trend.gun_avg_price) }}</n-text>
                  <n-text
                    class="trend-change"
                    :style="{ color: getChangeColorByPercent(item.related_items_trend.gun_change_percent) }"
                  >
                    {{ item.related_items_trend.gun_change_percent > 0 ? '+' : '' }}{{ item.related_items_trend.gun_change_percent.toFixed(1) }}%
                  </n-text>
                </div>
                <div class="trend-row">
                  <n-text :depth="3" class="trend-category">配件均价</n-text>
                  <n-text class="trend-price">{{ formatPrice(item.related_items_trend.accessory_avg_price) }}</n-text>
                  <n-text
                    class="trend-change"
                    :style="{ color: getChangeColorByPercent(item.related_items_trend.accessory_change_percent) }"
                  >
                    {{ item.related_items_trend.accessory_change_percent > 0 ? '+' : '' }}{{ item.related_items_trend.accessory_change_percent.toFixed(1) }}%
                  </n-text>
                </div>
                <div class="trend-row">
                  <n-text :depth="3" class="trend-category">原材料均价</n-text>
                  <n-text class="trend-price">{{ formatPrice(item.related_items_trend.material_avg_price) }}</n-text>
                  <n-text
                    class="trend-change"
                    :style="{ color: getChangeColorByPercent(item.related_items_trend.material_change_percent) }"
                  >
                    {{ item.related_items_trend.material_change_percent > 0 ? '+' : '' }}{{ item.related_items_trend.material_change_percent.toFixed(1) }}%
                  </n-text>
                </div>
              </div>
            </div>

            <!-- 联动方向和强度 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">联动方向</n-text>
              </div>
              <div class="linkage-data">
                <n-tag size="small" type="success" class="linkage-tag">{{ item.linkage_direction }}</n-tag>
              </div>
            </div>

            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">联动强度</n-text>
              </div>
              <div class="linkage-strength">
                <div class="strength-bar">
                  <div class="strength-progress" :style="{ width: (item.linkage_strength * 100) + '%' }"></div>
                </div>
                <n-text class="strength-text">{{ (item.linkage_strength * 100).toFixed(0) }}%</n-text>
              </div>
            </div>

            <!-- 季节性 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">季节性</n-text>
              </div>
              <div class="seasonality-data">
                <n-tag size="small" class="seasonality-tag">{{ getSeasonalityText(item.analysis.seasonality) }}</n-tag>
              </div>
            </div>

            <!-- 日均变化率 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">日均变化率</n-text>
              </div>
              <div class="daily-change">
                <n-text
                  class="change-rate"
                  :style="{ color: getChangeColorByPercent(item.analysis.daily_change_rate) }"
                >
                  {{ item.analysis.daily_change_rate > 0 ? '+' : '' }}{{ item.analysis.daily_change_rate.toFixed(2) }}% / 天
                </n-text>
              </div>
            </div>

            <!-- 历史均价 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">历史均价</n-text>
              </div>
              <div class="historical-data">
                <div class="history-table">
                  <div class="history-header">
                    <n-text :depth="3" class="history-period">30天</n-text>
                    <n-text :depth="3" class="history-period">60天</n-text>
                    <n-text :depth="3" class="history-period">90天</n-text>
                  </div>
                  <div class="history-values">
                    <n-text class="history-price">{{ formatPrice(item.analysis.last_30_days_avg) }}</n-text>
                    <n-text class="history-price">{{ formatPrice(item.analysis.last_60_days_avg) }}</n-text>
                    <n-text class="history-price">{{ formatPrice(item.analysis.last_90_days_avg) }}</n-text>
                  </div>
                </div>
              </div>
            </div>

            <!-- 预测可靠性 -->
            <div class="analysis-section">
              <div class="section-label">
                <n-text :depth="3" class="label-text">预测可靠性</n-text>
              </div>
              <div class="reliability-data">
                <div class="reliability-bar">
                  <div class="reliability-progress" :style="{ width: (item.analysis.trend_reliability.stability * 100) + '%' }"></div>
                </div>
                <div class="reliability-info">
                  <n-text class="reliability-text">数据点 {{ item.analysis.trend_reliability.data_points }}</n-text>
                  <n-text class="reliability-text">稳定性 {{ (item.analysis.trend_reliability.stability * 100).toFixed(0) }}%</n-text>
                  <n-text class="reliability-text">一致性 {{ (item.analysis.trend_reliability.consistency * 100).toFixed(0) }}%</n-text>
                </div>
              </div>
            </div>
          </div>
          </n-collapse-transition>
        </div>
      </div>
    </n-card>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import type { BulletPredictItem } from '@/types/bulletPrice'
import FuturePriceMiniChart from './FuturePriceMiniChart.vue'
import PriceHistoryMiniChart from './PriceHistoryMiniChart.vue'


// Props
defineProps<{
  item: BulletPredictItem
}>()

// 响应式数据
const showMarketAnalysis = ref(false)

// 切换市场分析显示状态
const toggleMarketAnalysis = () => {
  showMarketAnalysis.value = !showMarketAnalysis.value
}

// 格式化价格
const formatPrice = (price: number | string): string => {
  const numPrice = typeof price === 'string' ? parseFloat(price) : price
  return `${numPrice.toLocaleString()} 哈夫币`
}

// 获取等级样式类
const getGradeClass = (grade: number): string => {
  const gradeMap: Record<number, string> = {
    1: 'grade-1',
    2: 'grade-2', 
    3: 'grade-3',
    4: 'grade-4',
    5: 'grade-5'
  }
  return gradeMap[grade] || 'grade-1'
}



// 获取可信度类型
const getConfidenceType = (confidence: string): 'success' | 'warning' | 'error' => {
  switch (confidence) {
    case 'high':
      return 'success'
    case 'medium':
      return 'warning'
    default:
      return 'error'
  }
}

// 获取可信度文本
const getConfidenceText = (confidence: string): string => {
  switch (confidence) {
    case 'high':
      return '高可信'
    case 'medium':
      return '中可信'
    default:
      return '低可信'
  }
}

// 获取变化百分比
const getChangePercent = (currentPrice: number | string, predictPrice: number | string): string => {
  const numCurrentPrice = typeof currentPrice === 'string' ? parseFloat(currentPrice) : currentPrice
  const numPredictPrice = typeof predictPrice === 'string' ? parseFloat(predictPrice) : predictPrice

  if (numCurrentPrice === 0) return '0%'
  const change = ((numPredictPrice - numCurrentPrice) / numCurrentPrice * 100)
  const sign = change > 0 ? '+' : ''
  return `${sign}${change.toFixed(1)}%`
}

// 获取变化颜色
const getChangeColor = (currentPrice: number | string, predictPrice: number | string): string => {
  const numCurrentPrice = typeof currentPrice === 'string' ? parseFloat(currentPrice) : currentPrice
  const numPredictPrice = typeof predictPrice === 'string' ? parseFloat(predictPrice) : predictPrice

  if (numPredictPrice > numCurrentPrice) return 'var(--n-error-color)'
  if (numPredictPrice < numCurrentPrice) return 'var(--n-success-color)'
  return 'var(--n-text-color-3)'
}

// 获取波动性文本
const getVolatilityText = (volatility: number): string => {
  if (volatility < 20) return '低波动'
  if (volatility < 50) return '中波动'
  return '高波动'
}

// 获取趋势强度文本
const getTrendStrengthText = (strength: string): string => {
  switch (strength) {
    case 'strong':
      return '强势'
    case 'weak':
      return '平缓'
    default:
      return '未知'
  }
}

// 根据百分比获取变化颜色
const getChangeColorByPercent = (percent: number): string => {
  if (percent > 0) return 'var(--n-error-color)'
  if (percent < 0) return 'var(--n-success-color)'
  return 'var(--n-text-color-3)'
}

// 获取季节性文本
const getSeasonalityText = (seasonality: string): string => {
  switch (seasonality) {
    case 'daily':
      return '日周期'
    case 'weekly':
      return '周周期'
    case 'none':
      return '无周期'
    default:
      return '未知'
  }
}


</script>

<style scoped>
.bullet-predict-card-large {
  height: 100%;
  width: 100%;
}

.predict-card {
  height: 100%;
  transition: all 0.3s ease;
  border: 1px solid var(--n-border-color);
}

.predict-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--n-color-primary-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

.bullet-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bullet-image-container {
  position: relative;
  width: 48px;
  height: 48px;
}

.bullet-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid;
}

.grade-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: white;
  border: 2px solid white;
}

.bullet-details {
  flex: 1;
}

.bullet-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--n-text-color);
}

.bullet-type {
  font-size: 12px;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.price-section {
  background: var(--n-color-hover);
  border-radius: 4px;
  padding: 4px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.price-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-align: center;
}

.price-label {
  font-size: 10px;
}

.price-value {
  font-size: 12px;
  font-weight: 600;
}

.price-value.current {
  color: var(--n-text-color);
}

.price-value.predict {
  color: var(--n-color-primary);
}

.price-value.change {
  font-weight: bold;
}





/* 通用样式 */
.section-title {
  margin-bottom: 8px;
}

.title-text {
  font-size: 12px;
  color: var(--n-text-color);
}

/* 基础分析指标 */
.basic-analysis-section {
  background: var(--n-color-hover);
  border-radius: 4px;
  padding: 4px;
}

.basic-metrics {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.metric-tag {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 60px;
  text-align: center;
  padding: 3px;
  background: var(--n-card-color);
  border-radius: 3px;
  border: 1px solid var(--n-border-color);
}

.metric-label {
  font-size: 9px;
}

.metric-value {
  font-size: 10px;
  font-weight: 500;
}

/* 市场分析指标 - 可展开 */
.market-analysis-toggle {
  background: var(--n-color-hover);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.toggle-header:hover {
  background: var(--n-color-pressed);
}

.toggle-title {
  font-size: 13px;
  color: var(--n-text-color);
}

.toggle-icon {
  transition: transform 0.2s ease;
  color: var(--n-text-color-disabled);
}

.toggle-icon.expanded {
  transform: rotate(180deg);
}

.market-analysis-content {
  padding: 0 4px 4px;
  border-top: 1px solid var(--n-border-color);
}

.analysis-section {
  margin-bottom: 6px;
}

.analysis-section:last-child {
  margin-bottom: 0;
}

.section-label {
  margin-bottom: 3px;
}

.label-text {
  font-size: 11px;
  font-weight: 500;
}

/* 价格区间 */
.price-range {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.range-text {
  font-size: 12px;
  font-weight: 500;
}

.range-bar {
  height: 6px;
  background: var(--n-border-color);
  border-radius: 3px;
  overflow: hidden;
}

.range-progress {
  height: 100%;
  background: linear-gradient(90deg, #18a058, #409eff);
  border-radius: 3px;
}

/* 支撑位/压力位 */
.support-resistance {
  display: flex;
  gap: 12px;
}

.sr-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sr-label {
  font-size: 10px;
}

.sr-value {
  font-size: 11px;
  font-weight: 500;
}

.sr-value.support {
  color: #18a058;
}

.sr-value.resistance {
  color: #d03050;
}

/* 周周期均价 */
.weekly-data {
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
  overflow: hidden;
}

.weekly-table {
  width: 100%;
}

.weekly-header {
  display: flex;
  background: var(--n-color-hover);
  padding: 6px 8px;
  border-bottom: 1px solid var(--n-border-color);
}

.week-header {
  flex: 1;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

.weekly-row {
  display: flex;
  padding: 4px 8px;
  border-bottom: 1px solid var(--n-border-color);
}

.weekly-row:last-child {
  border-bottom: none;
}

.week-day {
  flex: 1;
  font-size: 10px;
  text-align: center;
}

.week-price {
  flex: 1;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

/* 相关品类趋势 */
.related-trends {
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
  overflow: hidden;
}

.trend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--n-border-color);
}

.trend-row:last-child {
  border-bottom: none;
}

.trend-category {
  font-size: 10px;
  flex: 1;
}

.trend-price {
  font-size: 10px;
  font-weight: 500;
  flex: 1;
  text-align: center;
}

.trend-change {
  font-size: 10px;
  font-weight: bold;
  flex: 1;
  text-align: right;
}

/* 联动数据 */
.linkage-data {
  display: flex;
  justify-content: flex-start;
}

.linkage-tag {
  font-size: 11px;
}

.linkage-strength {
  display: flex;
  align-items: center;
  gap: 8px;
}

.strength-bar {
  flex: 1;
  height: 6px;
  background: var(--n-border-color);
  border-radius: 3px;
  overflow: hidden;
}

.strength-progress {
  height: 100%;
  background: #409eff;
  border-radius: 3px;
}

.strength-text {
  font-size: 11px;
  font-weight: 500;
  min-width: 40px;
}

/* 季节性 */
.seasonality-data {
  display: flex;
  justify-content: flex-start;
}

.seasonality-tag {
  font-size: 11px;
}

/* 日均变化率 */
.daily-change {
  display: flex;
  justify-content: flex-start;
}

.change-rate {
  font-size: 11px;
  font-weight: 500;
}

/* 历史均价 */
.historical-data {
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
  overflow: hidden;
}

.history-table {
  width: 100%;
}

.history-header {
  display: flex;
  background: var(--n-color-hover);
  padding: 6px 8px;
  border-bottom: 1px solid var(--n-border-color);
}

.history-period {
  flex: 1;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

.history-values {
  display: flex;
  padding: 6px 8px;
}

.history-price {
  flex: 1;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
}

/* 预测可靠性 */
.reliability-data {
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
  padding: 8px;
}

.reliability-bar {
  height: 6px;
  background: var(--n-border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.reliability-progress {
  height: 100%;
  background: #f0a020;
  border-radius: 3px;
}

.reliability-info {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.reliability-text {
  font-size: 9px;
  flex: 1;
  text-align: center;
}

/* 历史价格趋势 */
.price-history-section {
  background: var(--n-color-hover);
  border-radius: 4px;
  padding: 4px;
}

/* 未来价格预测 */
.future-predictions-section {
  background: var(--n-color-hover);
  border-radius: 4px;
  padding: 4px;
}

.predictions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.prediction-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: center;
  padding: 3px;
  background: var(--n-card-color);
  border-radius: 3px;
  border: 1px solid var(--n-border-color);
}

.prediction-date {
  font-size: 9px;
}

.prediction-price {
  font-size: 10px;
  font-weight: 500;
}

.prediction-change {
  font-size: 9px;
  font-weight: bold;
}

/* 价格目标时间 */
.target-prices-section {
  background: var(--n-color-hover);
  border-radius: 4px;
  padding: 4px;
}

.targets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px;
  background: var(--n-card-color);
  border-radius: 3px;
  border: 1px solid var(--n-border-color);
}

.target-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-value {
  font-size: 12px;
  font-weight: 500;
}

.target-date {
  font-size: 10px;
}

.target-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.target-days {
  font-size: 10px;
}

.target-change {
  font-size: 11px;
  font-weight: bold;
}

/* 等级样式 */
.grade-1 { border-color: var(--grade-border-1); background-color: var(--grade-bg-1); }
.grade-2 { border-color: var(--grade-border-2); background-color: var(--grade-bg-2); }
.grade-3 { border-color: var(--grade-border-3); background-color: var(--grade-bg-3); }
.grade-4 { border-color: var(--grade-border-4); background-color: var(--grade-bg-4); }
.grade-5 { border-color: var(--grade-border-5); background-color: var(--grade-bg-5); }
.grade-6 { border-color: var(--grade-border-6); background-color: var(--grade-bg-5); }

/* 市场分析指标 */
.market-analysis-section {
  background: var(--n-color-hover);
  border-radius: 6px;
  padding: 12px;
}

.analysis-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.analysis-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.analysis-item.full-width {
  flex: 1;
}

.analysis-label {
  font-size: 11px;
}

.analysis-value {
  font-size: 12px;
  font-weight: 500;
}

/* 周周期均价 */
.weekly-pattern-section {
  background: var(--n-color-hover);
  border-radius: 6px;
  padding: 12px;
}

.weekly-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.weekly-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  padding: 4px;
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
}

.week-day {
  font-size: 10px;
}

.week-price {
  font-size: 10px;
  font-weight: 500;
}

/* 相关品类趋势 */
.related-trends-section {
  background: var(--n-color-hover);
  border-radius: 6px;
  padding: 12px;
}

.trends-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.trend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
}

.trend-label {
  font-size: 11px;
}

.trend-value-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.trend-price {
  font-size: 11px;
  font-weight: 500;
}

.trend-change {
  font-size: 10px;
  font-weight: bold;
}

.linkage-info {
  display: flex;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--n-border-color);
}

.linkage-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.linkage-label {
  font-size: 11px;
}

.linkage-value {
  font-size: 12px;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .bullet-image-container {
    width: 40px;
    height: 40px;
  }

  .bullet-name {
    font-size: 14px;
  }

  .price-row {
    flex-direction: column;
    gap: 8px;
  }

  .price-item {
    text-align: left;
  }

  .analysis-row {
    flex-direction: column;
    gap: 8px;
  }

  .chart-container {
    min-height: 60px;
  }

  .predictions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
  }

  .weekly-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .linkage-info {
    flex-direction: column;
    gap: 8px;
  }
}

/* 其他指标 */
.other-metrics-section {
  background: var(--n-color-hover);
  border-radius: 6px;
  padding: 12px;
}

.metrics-grid {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.metric-label {
  font-size: 11px;
}

.metric-value {
  font-size: 12px;
  font-weight: 500;
}

/* 历史均价 */
.historical-prices {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--n-border-color);
}

.history-title {
  font-size: 11px;
  margin-bottom: 8px;
  display: block;
}

.history-grid {
  display: flex;
  gap: 12px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-align: center;
  padding: 6px;
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
}

.history-period {
  font-size: 10px;
}

.history-price {
  font-size: 11px;
  font-weight: 500;
}

/* 预测可靠性 */
.reliability-section {
  margin-top: 12px;
}

.reliability-title {
  font-size: 11px;
  margin-bottom: 8px;
  display: block;
}

.reliability-grid {
  display: flex;
  gap: 12px;
}

.reliability-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-align: center;
  padding: 6px;
  background: var(--n-card-color);
  border-radius: 4px;
  border: 1px solid var(--n-border-color);
}



.reliability-value {
  font-weight: 500;
}

/* 移动端额外调整 */
@media (max-width: 480px) {
  .metrics-grid {
    flex-direction: column;
    gap: 8px;
  }

  .history-grid {
    flex-direction: column;
    gap: 6px;
  }

  .reliability-grid {
    flex-direction: column;
    gap: 6px;
  }

  .price-section,
  .price-history-section,
  .future-predictions-section,
  .target-prices-section,
  .basic-analysis-section {
    padding: 3px;
  }

  .card-content {
    gap: 4px;
  }
}
</style>
